package com.funny.stock.base.util;

import com.funny.stock.base.vo.TradeType;

import java.math.BigDecimal;

/**
 * @author pengl
 * @date 2020/05/23
 **/
public class CalcUtil {

    public static BigDecimal calc(Integer action,BigDecimal val,BigDecimal opVal){
//        if(action == null) return val;

        if(action == TradeType.BUY.getType()){
            return val.add(opVal);
        }else if(action == TradeType.SELL.getType()){
            return val.subtract(opVal);
        }

        return val;
    }

}
